package work3;

import java.util.Scanner;

public class Judge {
    Scanner input1 = new Scanner(System.in);

    Palyer palyer = new Palyer();
    Computer computer = new Computer();
    int score = 0;
    int score1 = 0;
    int count=0;

    public Judge() {

    }

    public void check() {
        int b;//玩家出的
        int c;//电脑出的

        System.out.println("开始游戏?(y/n)");
        String answer = input1.next();

        while (answer.equalsIgnoreCase("y")) {
            b = palyer.input();
            c = computer.guess();


            if ((b == 0 && c == 0) || (b == 1 && c == 1) || (b == 2 && c == 2)) {
                System.out.println("平局");
                count++;
                //记录较量总次数
            } else if ((b == 0 && c == 1) || (b == 1 && c == 2) || (b == 2 && c == 0)) {
                System.out.println("玩家胜");
                count++;
                score++;
            } else {
                System.out.println("电脑胜");
                count++;
                score1++;
            }
            System.out.println("是否继续？(y/n)");
            answer=input1.next();
        }
        result();

    }



    public void result(){
        System.out.println("对局次数:" + count);
        System.out.println("玩家胜次数:" + score);
        System.out.println("电脑胜次数:" + score1);


    }



}




